import request from '@/utils/request'

export const getArtListAPI = function (params) {
  return request({
    url: '/v1_0/articles',
    params
  })
}

/**
 * 将文章设置为不感兴趣
 * @param {*} id是文章的id
 * @returns  接口数据
 */
export const dislikeArticleAPI = function (id) {
  return request({
    method: 'post',
    url: '/v1_0/article/dislikes',
    data: {
      target: id
    }
  })
}

/**
 *
 * @param {*} target  文章的 Id
 * @param {*} type  举报的类型
 * @returns
 */
export const reportArticleAPI = function (target, type) {
  return request({
    method: 'post',
    url: '/v1_0/article/reports',
    data: {
      target, // 文章的 Id
      type // 举报的类型
    }
  })
}

/**
 *  获取所有频道列表
 * @param {*} params
 * @returns
 */
export const getAllchannelsAPI = function (params) {
  return request({
    method: 'GET',
    url: '/v1_0/channels',
    params
  })
}

/**
 * 将频道数据存储到数据库
 * @param {*} data
 * @returns
 */
export const updateUserChannelAPI = function (channels) {
  return request.put('/v1_0/user/channels', {
    channels
  })
}
